from django.urls import path, include,re_path
from web.views import account, home, project, manage

urlpatterns = [
    path('sms', account.sms,name='sms'),
    path('register', account.RegisterView.as_view(),name='register'),
    path('login/sms', account.LoginSmsView.as_view(),name='login_sms'),
    path('login', account.LoginView.as_view(),name='login'),
    # 该链接是我们生成验证码图片接口，访问一次生成一次
    path('image_code', account.image_code,name='image_code'),
    path('index', home.index,name='index'),
    path('logout', home.logout,name='logout'),


    # 项目列表
    path('project/list', project.ProjectList.as_view(),name='project_list'),
    # 如果你要星标我的项目     /project/star/my/1
    # 如果你要星标我参加的项目 /project/star/join/1
    re_path(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)$', project.project_star,name='project_star'),
    # 取消星表
    re_path(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)$', project.project_unstar,name='project_unstar'),


    re_path(r'^manage/(?P<project_id>\d+)/dashboard$', manage.dashboard, name='dashboard'),
    re_path(r'^manage/(?P<project_id>\d+)/issues$', manage.issues, name='issues'),
    re_path(r'^manage/(?P<project_id>\d+)/statistics$', manage.statistics, name='statistics'),
    re_path(r'^manage/(?P<project_id>\d+)/file$', manage.file, name='file'),
    re_path(r'^manage/(?P<project_id>\d+)/wiki$', manage.wiki, name='wiki'),
    re_path(r'^manage/(?P<project_id>\d+)/setting$', manage.setting, name='setting'),

    # path('manage/(?P<project_id>\d+)/', include([
    #     path('dashboard', manage.dashboard, name='dashboard'),
    #     path('issues', manage.issues, name='issues'),
    #     path('statistics', manage.statistics, name='statistics'),
    #     path('file', manage.file, name='file'),
    #     path('wiki', manage.wiki, name='wiki'),
    #     path('setting', manage.setting, name='setting'),
    # ])),
]
